import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

export const constantRoutes = [
  {
    path: '/',
    component: () => import('@/views/Login/index'),
    hidden: true
  },
  {
    path: '/alipay',
    component: () => import('@/views/Sign/alipay.vue'),
    hidden: true
  },
  {
    path: '/homePage',
    component: Layout,
    children: [{
      path: '/homePage',
      name: '',
      component: () => import('@/views/HomePage/HomePage'),
      meta: { title: '工作台', icon: 'el-icon-monitor' }
    }]
  },
  // 签约管理
  {
    path: '/sign',
    component: Layout,
    meta: { title: '签约管理', icon: 'el-icon-edit' },
    children: [
    {
      path: '/sign01',
      name: '',
      component: () => import('@/views/Sign/show'),
      meta: { title: '待处理签约', icon: '' }
    },
    {
      path: '/sign02',
      name: '',
      component: () => import('@/views/Sign/show1'),
      meta: { title: '签约记录', icon: '' }
    },
    {
      path: '/sign03',
      name: 'sign03',
      component: () => import('@/views/Sign/chakanxiangqing.vue'),
      // meta: { title: '签约记录', icon: '' }
    },
    {
      path: '/sign04',
      name: '',
      component: () => import('@/views/Sign/edit1.vue'),
      // meta: { title: '签约记录', icon: '' }
    },
    {
      path: '/sign05',
      name: '',
      component: () => import('@/views/Sign/chakanxiangqing1.vue'),
      // meta: { title: '签约记录', icon: '' }
    },
    {
      path: '/sign06',
      name: '',
      component: () => import('@/views/Sign/edit2.vue'),
      // meta: { title: '签约记录', icon: '' }
    }
  ]
  },
  // 服务管理
  {
    path: '/serve',
    component: Layout,
    meta: { title: '服务管理', icon: 'el-icon-notebook-1' },
    children: [
    {
      path: '/serve01',
      name: '',
      component: () => import('@/views/Serve/show'),
      meta: { title: '待处理服务', icon: '' }
    },
    {
      path: '/serve02',
      name: '',
      component: () => import('@/views/Serve/serviceLog'),
      meta: { title: '服务记录', icon: '' }
    },
    {
      path: '/serve03',
      name: '',
      component: () => import('@/views/Serve/pendingAudit.vue'),
    },
    {
      path: '/serve04',
      name: '',
      component: () => import('@/views/Serve/redactServiceMessage.vue'),
    },
    {
      path: '/serve05',
      name: '',
      component: () => import('@/views/Serve/completeRecordDetails.vue'),
    },
    {
      path: '/serve06',
      name: '',
      component: () => import('@/views/Serve/doctorShow.vue'),
    },
    {
      path: '/serve07',
      name: '',
      component: () => import('@/views/Serve/doctorbianji.vue'),
    },
    {
      path: '/serve08',
      name: '',
      component: () => import('@/views/Serve/addserve.vue'),
    },
    {
      path: '/addPeople',
      component: () => import('@/views/People/AddPeople.vue'),
    },
    {
      path: '/perfectPeople',
      component: () => import('@/views/People/PerfectPeople.vue'),
    },
    {
      path: "/searchXq",
      component: () => import('@/views/People/SearchXq.vue'),
    },
    {
      path: '/gerenjianjie',
      component: () => import('@/views/Login/gerenjianjie.vue'),
    },
    {
      path: '/addServePage',
      component: () => import('@/views/Datas/addServePage.vue'),
    },
    {
      path: '/SearchServePage',
      component: () => import('@/views/Datas/SearchServePage.vue'),
    }
  ]
  },
  // 居民管理
  {
    path: '/people',
    component: Layout,
    children: [
      {
      path: '/people',
      name: 'People',
      component: () => import('@/views/People/PeopleManagement'),
      meta: { title: '居民管理', icon: 'el-icon-chat-dot-square' }
      }
    ]
  },

  // 消息管理
  {
    path: '/messages',
    component: Layout,
    children: [{
      path: '/message',
      name: '/Message',
      component: () => import('@/views/Message/Message.vue'),
      meta: { title: '消息管理', icon: 'el-icon-files' },
    }]
  },

  //资料管理
  {
    path: '/datas',
    component: Layout,
    hidden: false,
    meta: { title: '资料管理', icon: 'el-icon-folder-opened' },
    children: [
    {
      path: '/datas03', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Sign/jigouguanli'),
      meta: { title: '机构管理', icon: '' }
    },
    {
      path: '/datas04', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Sign/tuanduiguanli'),
      meta: { title: '团队管理', icon: '' }
    },
    {
      path: '/datas01', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Serve/doctorManagement'),
      meta: { title: '医生管理', icon: '' }
    },
    {
      path: '/datas02', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Datas/ServePage'),
      meta: { title: '服务包管理', icon: '' }
    },
    {
      path: '/datas05', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Serve/serviceManagement'),
      meta: { title: '服务项目管理', icon: '' }
    },
    {
      path: '/datas06', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Sign/edit3'),
    },
    {
      path: '/datas07', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Sign/edit4'),
    },
    {
      path: '/datas10', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Serve/servicemubianji'),
    },
    {
      path: '/datas11', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Serve/adddoctor'),
    },
    {
    path: '/datas08', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Sign/addjigou'),
    },
    {
      path: '/datas09', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Sign/adddoctor'),
    }
  ]
  },

  //数据统计
  {
    path: '/Datum',
    component: Layout,
    hidden: false,
    meta: { title: '数据统计', icon: 'el-icon-s-data' },
    children: [
    {
      path: '/datum01', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Datas/DataGeneral'),
      meta: { title: '数据概况', icon: '' }
    },
    {
      path: '/datum02', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Datas/Sign'),
      meta: { title: '签约业绩统计', icon: '' }
    },
    {
      path: '/datum03', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Datas/Performance.vue'),
      meta: { title: '服务业务统计', icon: '' }
    }
  ]
  },

  //系统设置
  {
    path: '/set',
    component: Layout,
    hidden: false,
    meta: { title: '系统设置', icon: 'el-icon-setting' },
    children: [
    {
      path: '/set01', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Set/TagsApp.vue'),
      meta: { title: '标签管理', icon: '' }
    },
    {
      path: '/set02', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Set/RoleApp'),
      meta: { title: '角色管理', icon: '' }
    },
    {
      path: '/set03', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Set/CounselingApp'),
      meta: { title: '资讯管理', icon: '' }
    },
    {
      path: '/set04', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Set/SlideshowApp.vue'),
      meta: { title: '轮播图管理', icon: '' }
    },
    {
      path: '/set05', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Set/SystemApp.vue'),
      meta: { title: '系统公告', icon: '' }
    },
    {
      path: '/set06', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Set/AgreementApp.vue'),
      meta: { title: '协议管理', icon: '' }
    },
    {
      path: '/set07', // 如果children path置空的话 当前这个路由会作为一级渲染的默认路由
      name: '',
      component: () => import('@/views/Set/OperationApp.vue'),
      meta: { title: '操作日志', icon: '' }
    }
  ]
  },
  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },
  {
    path:'/userpwd',
    component: Layout,
    hidden:true,
    children:[
      {
        path: '/updateUserPwd',
        name: '',
        component: () => import('@/views/Login/UpdatePwd'),
      }
    ]
  }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  mode: 'hash',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// reset 路由方法
export function resetRouter() {
  // 得到一个全新的router实例对象
  const newRouter = createRouter()
  // 使用新的路由记录覆盖掉老的路由记录
  router.matcher = newRouter.matcher // reset router
}

export default router
